<?php
include_once("./function.php");
//print_r($_GET);//Array ( [oid] => 144 [user_id] => 5 )
extract($_GET);//$oid $user_id
	
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>商品添加</title>
<base target="_self">
<link rel="stylesheet" type="text/css" href="skin/css/base.css" />
<link rel="stylesheet" type="text/css" href="skin/css/main.css" />
<style>td{font-size:18px;}th{font-size:20px;}font{font-size:1.2em;}</style>
</head>
<body leftmargin="8" topmargin='8'>
<form action="do_product_add.php" method="post" id="form" onsubmit="return check();" enctype="multipart/form-data">
<table width="98%" align="center" border="0" cellpadding="3" cellspacing="1" bgcolor="#CBD8AC" style="margin-bottom:8px;margin-top:8px;">
  <tr>
    <td background="skin/images/frame/wbg.gif" bgcolor="#EEF4EA" class='title' colspan="2"><span><img src='skin/images/frame/arr3.gif' style='margin-right:10px;'>订单详情</span></td>
  </tr>
  <tr bgcolor="#FFFFFF">
    <td>
		<table style="margin-bottom:8px;margin-top:8px;margin-left:20px;" border=0>
		<?php $sql="select * from ts_order where order_id='$oid'";
			$res=mysqli_query($link,$sql);
			if(is_object($res))
			{
				if(mysqli_num_rows($res)==1)
				{
					$onlyone=mysqli_fetch_assoc($res);
				}
			}
			$sql="select * from ts_user where uid='$user_id'";
			$res=mysqli_query($link,$sql);
			if(is_object($res))
			{
				if(mysqli_num_rows($res)==1)
				{
					$one2=mysqli_fetch_assoc($res);
				}
			}
			$sql="select * from ts_address where u_id='$user_id'";
			$res=mysqli_query($link,$sql);
			if(is_object($res))
			{
				if(mysqli_num_rows($res)==1)
				{
					$one3=mysqli_fetch_assoc($res);
				}
			}
		?>
		<tr>
			<td width="150px">订单号:</td>
			<td align="left"><?=$onlyone['order_sn']?></td>	
		</tr>
		<tr>
			<td>下单时间:</td>
			<td><?=date("Y-m-d H:i:s",$onlyone['order_time'])?></td>
		 </tr>
		 <tr>
			 <td>购买者:</td>
			 <td><?=$one2['username']?></td>
		 </tr>
		 <tr>
			 <td>收货人:</td>
			 <td><?=$one3['consignee']?></td>
		</tr>
	    <tr>
			 <td>收货地址:</td>
			 <td><?=$one3['address']?></td>
	    </tr>
	    <tr>
			 <td>联系方式:</td>
			 <td><?=$one3['mobile']?></td>
	    </tr>
	    <tr>
			<td>订单总额:</td>
		    <td><?=$onlyone['subtotal']?></td>
		</tr>
		<tr>
			<td>付款状态:</td>
		    <td>
			<?php if($onlyone['pay_status']==0){?>
					<font color="red" size="5">未付款</font>
					<?php }elseif($onlyone['pay_status']==1){?>
					<font color="green">已付款</font>
				<?php }?>	
			</td>
		</tr>
		<tr>
			<td>发货状态:</td>
			<td>
			<?php if($onlyone['pay_status']==1){if($onlyone['delivery_status']==0){?>
					<font color="red" size="4">未发货
						<font color="blue" size="4">
							<a href="do_fahuo.php?order_id=<?=$onlyone['order_id']?>">去发货</a>
						</font>
					</font>
					<?php }elseif($onlyone['delivery_status']==1){?>
					<font color="green">已发货</font>
					<?php }elseif($onlyone['delivery_status']==2){?>
					<font color="green" size="4">已收货</font>
					<?php }} else{?>
					<font color="red" size="4">未发货</font>
					<?php }?>
			
			</td>
	    </tr>
		<tr>
			<td colspan=2>
				<table width="100%" height="auto" border=0 cellspacing=0 rules="rows" style="margin-top:50px;">
					<tr>
						<th></th>
						<th>商品图片</th>
						<th>商品名称</th>
						<th>商品价格</th>
						<th>商品颜色</th>
						<th>商品尺寸</th>
						<th>商品数量</th>
					</tr>
					<tr>
						<td rowspan=2 align="center" height="200px" width="150px">商品信息</td>
					<?php $sql="select * from ts_order_goods where oid='$oid' and uid='$user_id'";
					//echo $sql;var_dump(mysqli_query($link,$sql));
						  $res=mysqli_query($link,$sql);
						  if(is_object($res))
						  {//echo 5;die;
							if(mysqli_num_rows($res)>0)
							 {
								$arr=array();
								while(($list=mysqli_fetch_assoc($res))!=false)
								 {
									$arr[]=$list;
								 }
							 }
						  }
						 //print_r($arr);
					if(isset($arr)){foreach($arr as $v){
					$sql="select * from ts_product where pid=$v[pid]";
					$res=mysqli_query($link,$sql);
					if(is_object($res))
					{
						if(mysqli_num_rows($res)>0)
						{
							$one=mysqli_fetch_assoc($res);
						}
					}	
					?>
						<td width="250px" align="center"><img src="./<?=$one['thumb']?>" width="100px" height="100px"></td>
						<td width="250px" align="center"><?=$one['pname']?></td>
						<td width="150px" align="center"><?=$one['price']?></td>
						<td width="150px" align="center"><?=$v['color']?></td>
						<td width="150px" align="center"><?=$v['size']?></td>
						<td width="150px" align="center"><?=$v['num']?></td>
					</tr>
					<?php }}?>
				</table>
			</td>
		</tr>
		</table>
	</td>
  </tr>
</table>
</form>
</body>
</html>

